package com.guestmanage.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.guestmanage.bean.RdgionYu2;
import com.guestmanage.service.SpRecvLisService;
import com.guestmanage.servlet.util.BaseAction;

public class SpRecvLisCity extends HttpServlet{

	private static final long serialVersionUID = 2976674949977773250L;
	
	private SpRecvLisService srlSer=SpRecvLisService.getInsetance();
	
	public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException{
		BaseAction base=new BaseAction(request,response);
		
		List<RdgionYu2> sy2_list=srlSer.findSheng();
		
		base.setAttribute("sy2_list", sy2_list);
		base.forward("guestManage/monitor/spRecvLisAdd.jsp");
	}
	
	public void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException{
		BaseAction base=new BaseAction(request,response);
		
		String sheng=base.getParameterString("sheng");
		sheng=new String(sheng.getBytes("GBK"),"utf-8");
		List<RdgionYu2> sy2_list=srlSer.findCityBySheng(sheng);
		
		String msg="";
		for(RdgionYu2 sy2:sy2_list){
			msg+="<option value='"+sy2.getCity()+"'>"+sy2.getCity()+"</option>";
		}
		
		base.printWriter(msg);
	}

}
